﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace QuanLyKhachSan
{
    public partial class frmDangNhap : Form
    {
        public frmManHinhChinh frmmh;
        public NguoiDungDTO nddto = null;
        public frmDangNhap()
        {
            InitializeComponent();
        }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            NguoiDungBUS ndbus = new NguoiDungBUS();
            string user=txtTenDangNhap.Text;
            string pass=txtMatKhau.Text;
            if (ndbus.DangNhap(user, pass))
            {
                nddto = ndbus.LayNguoiDungByTenDangNhap(user);
                this.Close();
            }
            else
            {
                MessageBox.Show("sai tên đăng nhập hoặc mật khẩu", "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtTenDangNhap.Focus();
            }
        }

      
        private void frmDangNhap_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                btnDangNhap_Click(sender, e);
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        
    }
}
